﻿using System.Web.Mvc;

namespace GuRenFang.Web.Areas.WebSite
{
    public class WebSiteAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "WebSite";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            context.Routes.IgnoreRoute("elmah.axd");
            context.Routes.IgnoreRoute("{*alljs}", new { alljs = @".*\.js?" });
            context.Routes.IgnoreRoute("{*allashx}", new { allashx = @".*\.ashx?" });
            context.Routes.IgnoreRoute("{*allhtml}", new { allhtml = @".*\.htm?" });
            context.Routes.IgnoreRoute("{*allcss}", new { allcss = @".*\.css?" });
            context.Routes.IgnoreRoute("{*allimages}", new { allimages = @".*\.ico?|.*\.jpg?|.*\.png?|.*\.gif?" });

            context.MapRoute(
               "Error", 
               "Error", 
               new { controller = "Home", action = "Error", id = UrlParameter.Optional }, // 参数默认值
               new string[] { "GuRenFang.Controllers.WebSite" }
           );
            context.MapRoute(
               "About-us", // 关于我们
               "about-us", // 带有参数的 URL
               new { controller = "Home", action = "AboutUs", id = UrlParameter.Optional }, // 参数默认值
               new string[] { "GuRenFang.Controllers.WebSite" }
           );
            context.MapRoute(
               "PackageServices", // 套餐服务
               "Package-Services", // 带有参数的 URL
               new { controller = "Packages", action = "List", id = UrlParameter.Optional } // 参数默认值
               , new string[] { "GuRenFang.Controllers.WebSite" }
           );
            context.MapRoute(
               "PhotoShow", // 写真作品展示
               "photograph-show/portrait/",
               new { controller = "Pictorial", action = "Index" },
                new string[] { "GuRenFang.Controllers.WebSite" }
           );
            context.MapRoute(
               "PhotoShow-wedding", // 婚纱作品展示
               "photograph-show/wedding-dress/",
               new { controller = "Wedding", action = "Index" },
                new string[] { "GuRenFang.Controllers.WebSite" }
           );
            context.MapRoute(
                "WebSite_default",
                "{controller}/{action}/{id}",
                new { controller="Home",action = "Index", id = UrlParameter.Optional }
                , new string[] { "GuRenFang.Controllers.WebSite" }
            );
        }
    }
}
